package com.qykj.ddhing.pda.demo.databinding;

import android.databinding.BaseObservable;
import android.databinding.Bindable;
import android.databinding.ObservableInt;
import android.view.View;

import com.android.databinding.library.baseAdapters.BR;
import com.google.gson.Gson;
import com.qykj.ddhing.pda.common.LogUtil;

/**
 * author : 0000
 * desc   :
 * time   : 2018/07/19
 * updateTime : 2018/07/19
 */

public class User extends BaseObservable {
    private int code;
    private boolean success;
    public  String firstName;
    public  String lastName;
    private String name;
    private String pws;
    public ObservableInt goToSimple = new ObservableInt();

    public void goToNext(View view) {
        goToSimple.notifyChange();
    }
    // 这个@Inject表示可以提供User类型的实例
//    @Inject
    public User() {
        this.name = "this is test 无参数构造";
    }
    public User(String firstName, String lastName) {
        this.firstName = firstName;
        this.lastName = lastName;
    }
    @Bindable
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPws() {
        return pws;
    }

    public void setPws(String pws) {
        this.pws = pws;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }
    @Bindable
    public String getFirstName() {
        LogUtil.getLogUtil_LXF().d("getFirstName firstName:"+firstName);
        return firstName;
    }

    public void setFirstName(String firstName) {
        notifyPropertyChanged(BR.firstName);
        this.firstName = firstName;
    }
    @Bindable
    public String getLastName() {
        LogUtil.getLogUtil_LXF().d("getLastName lastName:"+lastName);
        return lastName;
    }

    public void setLastName(String lastName) {
//        notifyPropertyChanged(BR.firstName);
        this.lastName = lastName;
    }

    @Override
    public String toString() {
        return new Gson().toJson(this);
    }
}
